Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavlink check transmit buffer before send #10394

Closed
wants to merge 4 commits into from
Closed

Conversation

dagar
Copy link
Member

@dagar dagar commented Sep 2, 2018

LorenzMeier
LorenzMeier previously approved these changes Sep 2, 2018
@dagar dagar requested a review from a team September 2, 2018 15:25
@dagar
Copy link
Member Author

dagar commented Sep 2, 2018

@PX4/testflights this needs testing, but we should sort out your radio issues first.

Scenarios to test and review (from logs).

  1. SiK radio with and without mavlink RADIO_STATUS working
  2. SiK radios with and without flow control physically connected

Enable logging from boot so that the log contains the initial parameter and mission sync. Then do a short flight so we can see how the mavlink module responds (gracefully degrading or not).

@LorenzMeier
Copy link
Member

Looks good to me, we just need to make sure we're not missing side effects. @bkueng Could you please also have a look?

@LorenzMeier LorenzMeier requested a review from bkueng September 2, 2018 18:17
@dagar
Copy link
Member Author

dagar commented Sep 2, 2018

We'll need to check the worst case mavlink packet size (largest + signing) that we'd like to support.

Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remarks:

  • There are race conditions where it will fail. However I see no correctnes errors.
  • signature header length is not included in get_size()

A simple & clean solution would be to change MAVLINK_START_UART_SEND to return a bool, and only call the _mavlink_send_uarts if it returns true. (https://github.com/mavlink/c_library_v2/blob/master/mavlink_helpers.h#L349)

@dagar
Copy link
Member Author

dagar commented Sep 3, 2018

A simple & clean solution would be to change MAVLINK_START_UART_SEND to return a bool, and only call the _mavlink_send_uarts if it returns true. (https://github.com/mavlink/c_library_v2/blob/master/mavlink_helpers.h#L349)

Actually I was thinking of doing that as well to catch the sends not coming from a stream update call. We'd need to find a way to introduce it as a non-breaking change to the upstream project (https://github.com/ArduPilot/pymavlink/blob/master/generator/C/include_v2.0/mavlink_helpers.h#L348-L355). On the PX4 side I'd still like to skip the work and save the data when possible.

There are race conditions where it will fail. However I see no correctnes errors.

Could you elaborate? I'm aware of the general disconnect between mavlink deciding it's time to send and the actual uorb data availability. Again, I'd strongly prefer to not throw away good data.

signature header length is not included in get_size()

This needs to be fixed regardless. Are you aware of any actual mavlink signing usage?

@santiago3dr
Copy link

couple flights on a pixracer (v4)
https://logs.px4.io/plot_app?log=bd9b756e-495e-4cfb-8936-4df94e3bb0dd
https://logs.px4.io/plot_app?log=290eed2d-7124-415c-a9cc-a79bdbbd024b

unable to establish proper connection; probably a hardware issue with SiK radio
1

@dagar
Copy link
Member Author

dagar commented Sep 6, 2018

As discussed offline, @santiago3dr's telemetry radios seem to have a severe problem unrelated to this PR. We'll reconvene for testing once there's a stable baseline.

@santiago3dr
Copy link

got the new telemtry radios which are getting good range.
did a range test on master 39221f
https://logs.px4.io/plot_app?log=809addb6-df5a-4d30-bd54-c619292c73e9
https://logs.px4.io/plot_app?log=9225eeca-4886-4ff5-adf9-393c768a151a

ran the same range test on this pr and rtl kept getting rejected; disconnected telemtry radio and still not able to engage rtl
https://logs.px4.io/plot_app?log=43e6ccdf-8ad2-46fb-951d-70ffe2d03ab9

@dagar thoughts?

@dagar
Copy link
Member Author

dagar commented Sep 16, 2018

@santiago3dr RTL failed because you didn't have a valid home position.

I've rebased the PR on master, could you try again?

@dagar dagar changed the title [DO NOT MERGE] Mavlink check transmit buffer before send Mavlink check transmit buffer before send Sep 16, 2018
@LorenzMeier
Copy link
Member

@santiago3dr Could you re-test? Thanks!

@santiago3dr
Copy link

santiago3dr commented Sep 19, 2018

mixed results
had difficulty maintaining connection and loading parameters
https://logs.px4.io/plot_app?log=6273d7fb-eb7c-4d45-9c5b-128d057b6d0b

great connection; better connection than with master
https://logs.px4.io/plot_app?log=6daf5df5-88b2-4ecb-b7d4-acbb4402ad91

same test and environment on master cfac2cc for comparison:
https://logs.px4.io/plot_app?log=0cd4d221-887e-4109-86e1-30c8c9ed6d69

@dagar dagar requested review from a team and removed request for a team September 19, 2018 22:50
@dagar
Copy link
Member Author

dagar commented Sep 19, 2018

@santiago3dr your radio RSSI looks much better, but in all of your logs mavlink is still reporting flow control disabled.
How is the radio wired? Check RTS/CTS.

image

@santiago3dr
Copy link

The hlybro radio's we got only have 4 wire connectors so no go on CTS and RTS
http://www.holybro.com/product/57

@dagar
Copy link
Member Author

dagar commented Sep 20, 2018

Well that's unfortunate. We have some other ideas that will help, but nothing immediate. This is all kind of secondary to this PR though.

@dogmaphobic FYI

@dagar
Copy link
Member Author

dagar commented Sep 20, 2018

@santiago3dr could you try newer QGC daily? With only telemetry connected take a look at "Loss rate" under Settings -> Mavlink.

image

@santiago3dr
Copy link

capture

stable 1~2% loss rate

@LorenzMeier
Copy link
Member

@dagar What's your conclusion here?

@dagar
Copy link
Member Author

dagar commented Oct 1, 2018

@dagar What's your conclusion here?

That this change is probably fine, but only addresses a subset of the many problems. I'll open another issue.

Update: new issue created #10618

@dagar
Copy link
Member Author

dagar commented Sep 11, 2019

Likely worth dropping this PR and starting again, but tagging @MaEtUgR @jkflying for historical reference.

@stale
Copy link

stale bot commented Dec 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Dec 10, 2019
@LorenzMeier
Copy link
Member

Closing as stale.

@LorenzMeier LorenzMeier deleted the pr-mavlink_check_buffer branch January 10, 2021 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants